import React from "react";
import { marked } from "marked";

const Markdown = (props: any) => {
  const { children } = props;

  /**
   * dangerouslySetInnerHTML 有XSS 风险,
   * marked(children)返回带有标签的字符串
   */
  return <div dangerouslySetInnerHTML={{ __html: marked(children) }} />;
};

export default Markdown;
